
run.template <- function(template.path, envir, temp.filename.base) {
    temp.filename <- paste(temp.filename.base, ".lgs", sep="")

    template <- file(template.path, 'r')
    brew(template, output=temp.filename, envir=envir) # writes to file
    close(template)

    shell(sprintf('"C:\\Program Files\\LatentGOLD5.0\\lg50.exe" %s', temp.filename))
}
